package cn.jobstart;

import cn.jobstart.task.YYTask;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author sunke
 * @version 1.0
 * @Description
 * @date 2023-10-30 16:50
 */

@Component
@Slf4j
public class YYCommand implements CommandLineRunner {


    @Resource
    private YYTask yyTask;
    @Value("${initYY}")
    private boolean initYY;

    /**
     * Callback used to run the bean.
     *
     * @param args incoming main method arguments
     * @throws Exception on error
     */
    @Override
    public void run(String... args) throws Exception {
        if (initYY) {
            yyTask.run();
        }
    }
}
